import java.util.HashSet;
import java.util.Objects;

class Voter {
    private String name;
    private String opinion;
    private static int count = 0;
    private static final int MAX_COUNT = 100;
    private static HashSet<Voter> voters = new HashSet<>();

    public Voter(String name, String opinion) {
        this.name = name;
        this.opinion = opinion;
    }

    public void vote() {
        if (count >= MAX_COUNT) {
            System.out.println("投票已结束，已达最大票数！");
            return;
        }
        if (voters.contains(this)) {
            System.out.println(name + "，请勿重复投票。");
            return;
        }
        voters.add(this);
        count++;
        System.out.println(name + " 感谢你的投票。");
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Voter voter = (Voter) o;
        return Objects.equals(name, voter.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name);
    }

    public static void printResult() {
        System.out.println("\n当前投票数为：" + count);
        System.out.println("参与投票的学生和结果如下：");
        voters.forEach(voter ->
                System.out.println(voter.name + " 意见 " + voter.opinion)
        );
    }
}

class VoteSystem {
    public static void main(String[] args) {

        Voter tom = new Voter("Tom", "是");
        tom.vote();  // 正常投票
        tom.vote();  // 重复投票

        Voter jack = new Voter("Jack", "是");
        jack.vote();

        Voter mike = new Voter("Mike", "是");
        mike.vote();


        Voter.printResult();


    }
}